package com.captainbank.tcl.tclapplication.ui.activity.function;

import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.widget.ImageView;

import com.captainbank.tcl.tclapplication.R;
import com.captainbank.tcl.tclapplication.model.TestBean;
import com.captainbank.tcl.tclapplication.ui.activity.basic.BaseActivity;
import com.captainbank.tcl.tclapplication.ui.adapter.TestAdapter;
import com.captainbank.tcl.tclapplication.utils.glide.GlideLoader;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;

/**
 * Created by TCL on 2019/8/13.
 * Describe:
 */
public class SmartRefreshLayoutActivity extends BaseActivity {
    @BindView(R.id.toolbar)
    Toolbar toolbar;
    @BindView(R.id.iv_header)
    ImageView ivHeader;
    @BindView(R.id.recyclerview)
    RecyclerView recyclerview;

    private List<TestBean> mList;
    private TestAdapter mTestAdapter;

    @Override
    protected int getLayoutId() {
        return R.layout.activity_smart_refresh_layout;
    }

    @Override
    protected void initData() {
        mList = new ArrayList<>();
        TestBean tb;
        for(int i=0;i<30;i++){
            tb = new TestBean();
            mList.add(tb);
        }
    }

    @Override
    protected void initView() {
        toolbar.setTitle(getString(R.string.title_smart_refresh_layout));
        GlideLoader.getInstance().initLoadImage(this,R.mipmap.eatting, ivHeader, GlideLoader.LoadOption.LOAD_RESOURCES);
        LinearLayoutManager layoutManager = new LinearLayoutManager(this);
        recyclerview.setLayoutManager(layoutManager);
        mTestAdapter = new TestAdapter(R.layout.item_test, mList);
        recyclerview.setAdapter(mTestAdapter);
    }

}
